import { useQuery } from "@apollo/react-hooks";
import gql from "graphql-tag";

export const SYS_ROLES = gql`
  query SysRoles {
    sysRoles {
      id
      description
    }
  }
`;

export const useRoles = () => {
  const { data } = useQuery(SYS_ROLES);
  const roles = (data && data.sysRoles) || [];
  return { roles };
};
